// createWebHashHistory 它在内部传递的实际 URL 之前使用了一个哈希字符(#)
// createWebHistory     当使用这种历史模式时，URL 会看起来很 "正常"
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router'

import Manage from './Manage.vue'
import List from "./List.vue"
import Detail from './Detail.vue'
import Index from './Index.vue'
import Doc from './Doc.vue'
import Test from './Test.vue'
import MetaView from './MetaView.vue'




export default function () {
  return createRouter({
    "history": createWebHistory(),
    "routes": [
      {
        path: '/manage',
        component: Manage,
        props: (route) => {
          return {
            "params": route.query
          }
        }
      },
      {
        path: '/index',
        component: Index
      },
      {
        path: '/list',
        component: List
      },
      {
        path: '/detail/:name',
        component: Detail,
        props: (route) => {
          return {
            "name": route.params.name,
            "requestParams": route.query
          }
        }
      },
      {
        path: '/doc',
        component: Doc
      },
      {
        "path": "/meta-view/:ns/:name",
        component: MetaView,
        props: (route) => {
          return {
            "ns": route.params.ns,
            "name": route.params.name,
            "params": route.query
          }
        }
      },
      {
        path: '/test',
        component: Test
      },
      {
        path: '/',
        redirect: '/manage'
      }
    ]
  })
};